<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <link href="/Public/common/4.3.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
    <!--[if IE 7]>
    <link href="/Public/common/4.3.0/css/font-awesome-ie7.min.css" type="text/css" rel="stylesheet" />
    <![endif]-->
    <link href="/Public/tuike/css/signIn.css" rel="stylesheet">
    <script src="/Public/common/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="/Public/common/js/placeholder.js" type="text/javascript"></script>
    <script>
        $(function(){
            $(".ver").click(function(){
                changeVerify();
            })
            $(".submit").click(function(){
                $action = $('form').attr('action');
                $username = $("#username").val();
                $password = $("#password").val();
                $verify = $("#verify").val();
				$(this).attr('disabled');
				$(this).html('登录中...');
                $.post($action,{username : $username,password : $password, verify :$verify
                }, function(data, textStatus) {
                    switch(data) {
                        case "1":
                            window.location.href='/index.php?s=/Promoter/Index/index.html';
                            break;
                        case "-1":
                            alert("验证码错误");
                            changeVerify();
							$("#verify").select();
                            break;
                        case "-2":
                            alert("账号密码不匹配");
                            changeVerify();
                            break;
                        case "-3":
                            alert("账号被停用")
                            changeVerify();
                            break;
                        default :
                            alert("发生未知异常");
                            changeVerify();
                    }
					$(".submit").removeAttr('disabled');
					$(".submit").html('确定');
					return false;
                });
            })

        });
        function changeVerify(){
            $(".ver").empty();
            $(".ver").append('<img class="verifyimg reloadverify" alt="点击切换" src="<?php echo U('verify');?>" style="height:45px;width:231px; cursor:pointer;">');
        }
        function enterIn(evt){
            var evt=evt?evt:(window.event?window.event:null);//兼容IE和FF
            if (evt.keyCode==13){
				$(".submit").trigger('click');
            }
        }

    </script>
</head>
<body onkeydown="enterIn(event)">

<div class="signIn">
    <from action="<?php echo U(login);?>" method = "post">
    <ul>
        <li><div><i class="fa fa-suitcase"></i><input type="text" name = "username" id = "username" placeholder="请输入账号" ></div></li>
        <li><div><i class="fa fa-key"></i><input type="password" name="password" id = "password" value="" placeholder="请输入您的密码"/></div></li>
        <li><input type="text"  name = "verify" id = "verify"  placeholder="验证码"  class="code" /><span class = "ver"><img class="verifyimg reloadverify" alt="点击切换" src="<?php echo U('verify');?>" style="height:45px;width:231px; cursor:pointer;"></span></li>
        <li><button type="button" class="submit" >确定</button></li>
    </ul>
    </from>
</div>
</body>
</html>